
const constants = {
    AUTH_SUCCESS: {
        code: 1101,
        desc: '认证成功'
    },
    AUTH_FAILURE:  {
        code: 1102,
        desc: '认证失败'
    },
    // Create
    CREATE_SUCCESS: { code: 2101 , desc: '创建成功' } ,
    CREATE_FAILURE: { code: 2102 , desc: '创建失败' } ,
    // Retrieve
    RETRIEVE_SUCCESS: { 
        code: 2201 , 
        desc: '查询成功' 
    } ,
    RETRIEVE_FAILURE: { 
        code: 2202 , 
        desc: '查询失败' 
    } ,
    RETRIEVE_ID_NOT_EXISTS: { 
        code: 2203 , 
        desc: 'ID在系统中不存在' 
    } ,
    RETRIEVE_ACCOUNT_EXISTS: { 
        code: 2204 , 
        desc: '账号在系统中已存在' 
    } ,
    RETRIEVE_EMAIL_EXISTS: { 
        code: 2205 , 
        desc: '邮箱在系统中已存在' 
    } ,
    RETRIEVE_TEL_EXISTS: { 
        code: 2206 , 
        desc: '手机号在系统中已存在' 
    } ,
    // Update
    UPDATE_SUCCESS:  { 
        code: 2301 , 
        desc: '更新成功' 
    } ,
    UPDATE_FAILURE: { 
        code: 2302 , 
        desc: '更新失败' 
    } ,
    // Delete
    DELETE_SUCCESS:  { 
        code: 2401 , 
        desc: '删除成功' 
    } ,
    DELETE_FAILURE: { 
        code: 2402 , 
        desc: '删除失败' 
    } ,
    // Validate
    VALIDATE_FAILURE: { 
        code: 2501 , 
        desc: '验证失败' 
    }
}

// 冻结 constants 对象
Object.freeze( constants );

const names = Object.getOwnPropertyNames( constants );

names.forEach( name => {
    let x = constants[ name ];
    Object.freeze( x );
});

module.exports = constants ;